package cn.changein.framework.base.database.factory;

import cn.changein.framework.base.database.entity.DatabaseInfo;
import cn.changein.framework.config.properties.DruidProperties;

/**
 * 配置文件的创建

 * @date: 2020-02-11
 * @copyright: 广州澄境科技有限公司
 */
public class DruidFactory {
    /**
     * 创建druid配置
     * @param databaseInfo
     * @return
     */
    public static DruidProperties createDruidProperties(DatabaseInfo databaseInfo) {
        DruidProperties druidProperties = new DruidProperties();

        druidProperties.setDriverClassName(databaseInfo.getJdbcDriver());
        druidProperties.setUsername(databaseInfo.getUserName());
        druidProperties.setPassword(databaseInfo.getPassword());
        druidProperties.setUrl(databaseInfo.getJdbcUrl());

        return druidProperties;
    }
}
